You are here: Building the Model: General Elements > Pre-defined Tank Subroutines > Tank_SelectOutput > Description
Selects an output tank from among several tanks based on a selection rule and optional product type. To use this function, list all tanks included in the selection decision together in the Location module.
Components
<First Tank>
The name or location index number of the starting tank in the range.
<Number of Tanks>
The number of tanks in the selection range (limit 10).
<Selection Rule>
The rule for making the selection may be one of the following:
Tank_InOrder (selects the first idle tank encountered)
Tank_LongestIdle (selects the tank idle the longest)
<Maximum Level>
The maximum level of the output tank before considering it for selection. Enter 0 if the output tank must be empty or idle before being considered.
<Product Type>
An integer specifying the required value of the Product array in order to select the tank. Enter 0 if the tank selection requires no product type match. (This applies only if the maximum level specified is greater than 0.)
Example
A supply tank feeds one of 3 output tanks and always gives preference first to Tank1, then to Tank2, and finally to Tank3 based on availability. Furthermore, the supply tank can select a tank only if its contents are less than 8000 gallons. To model this selection, list Tank1, Tank2, and Tank3 together (and in order) in the location module. Then define the following statement to select the tank using a local variable, Selected_Tank:
INT Selected_Tank
.
.
.
SelectedTank=Tank_SelectOutput(Tank1, 3, Tank_InOrder, 8000,0)
The diagram below shows the logic used to make a tank selection:
If you base a tank selection on product type, you must be careful to assign an appropriate integer value to the Product array element corresponding to the tank location.